home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Source Code / Libraries / VideoToolbox 96.06.15 / VideoToolboxSources / DatedString.c < prev    next >
Text File  |  1994-06-03  |  973b  |  28 lines

  1. /*
  2. DatedString.c
  3. returns a pointer to a string representing the time in a form suitable for
  4. use as a unique filename extension, e.g. "890625015959", that 
  5. sorts in chronological order. The supplied time should be obtained by
  6. calling Apple's GetDateTime() or Standard C's time(). 
  7. Both return seconds since midnight January 1, 1904.
  8.  
  9. HISTORY:
  10. 1989 dgp wrote it.
  11. 2/25/94    dgp    Noted above how to get the time.
  12. 3/19/94    dgp Removed the dots because the string was too long, using up nearly
  13.     the maximum length a filename.
  14. 5/28/94    dgp renamed from "DateString" to "DatedString" to avoid conflict with
  15.     Apple's Universal Headers. Thanks to Bob Dougherty 
  16.     (wolfgang@cats.ucsc.edu) for reporting the incompatibility.
  17. */
  18. #include "VideoToolbox.h"
  19.  
  20. char *DatedString(unsigned long seconds)
  21. {
  22.     DateTimeRec t;
  23.     static char dateString[26];
  24.     
  25.     Secs2Date(seconds,&t);
  26.     sprintf(dateString,"%02d%02d%02d%02d%02d%02d",t.year-1900,t.month,t.day,t.hour,t.minute,t.second);
  27.     return dateString;
  28. }